package com.sywb.chuangyebao.bean;

import com.alibaba.fastjson.JSON;
import com.sywb.chuangyebao.Constants;

import org.bining.footstone.db.annotation.Column;
import org.bining.footstone.db.annotation.PrimaryKey;
import org.bining.footstone.db.annotation.Table;
import org.bining.footstone.db.enums.AssignType;

import java.io.Serializable;

/**
 * 聊天会话信息
 */
@Table(Constants.TABLE_CHATSESSION)
public class ChatSession implements Serializable {

    @PrimaryKey(AssignType.BY_MYSELF)
    @Column("session_uid")
    public int session_uid; // 会话用户ID
    @Column("my_uid")
    public int my_uid; // 我的用户ID
    @Column("from_uid")
    public int from_uid; // 消息来源用户ID
    @Column("to_uid")
    public int to_uid; // 消息接收用户ID
    @Column("msg")
    public String msg;// 消息
    @Column("create_time")
    public long create_time;// 创建时间
    @Column("status")
    public int status;// 状态：1=已读，2=未读
    @Column("owner")
    public String owner;// 会话用户信息

    public NewsOwner getOwner() {
        NewsOwner newsOwner = JSON.parseObject(owner, NewsOwner.class);
        return newsOwner;
    }

}
